#ifndef _FLV_H_
#define _FLV_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <netinet/in.h>
typedef    unsigned long long		oal_uint64;
typedef    long long				oal_int64;
typedef    int						oal_int32;
typedef    unsigned int				oal_uint32;
typedef    unsigned short			oal_uint16;
typedef    short					oal_int16;
typedef    unsigned char		    oal_uint8;
typedef    char						oal_int8;
typedef    bool                    oal_bool;
typedef    void                     oal_void;
typedef struct uint24
{
    oal_uint8 first;
    oal_uint8 second;
    oal_uint8 third;
}__attribute__ ((__packed__))oal_uint24;
typedef struct flv_header
{
	oal_uint8  f_wrd;
	oal_uint8  s_wrd;
	oal_uint8  t_wrd;
	oal_uint8  version;
	oal_uint8  reserv:5;
	oal_uint8  audio:1;
	oal_uint8  res:1;
	oal_uint8  vedio:1;
	oal_uint32 offset;//flv头长度 		  
}__attribute__((__packed__))FLV_HEADER;
typedef struct flvtag_header
{
	oal_uint32 PreviousTagSize;//前一个tag的长度
	oal_uint8  tag_type;//  音频：ox8 视频：0x9 script: 0x12
	struct uint24 data_len;// 数据长度（字节），不包括头
	oal_uint32 timestamp;
	struct uint24 stream_id;//总是0
}__attribute__((__packed__))FLVTAG_HEADER;

typedef struct audio_head
{
	oal_uint8 audio_fmt:4;
	oal_uint8 sample_rate:2;
	oal_uint8 sample_size:1;
	oal_uint8 audio_channel:1;
}__attribute__((__packed__))AUDIO_HEAD;
typedef struct vedio_head
{
	oal_uint8  frame_type:4;
	oal_uint8  stream_id: 4;
}__attribute__((__packed__))VEDIO_HEAD;
typedef struct avc_head
{
	oal_uint8  avc_type;
}__attribute__((__packed__))AVC_HEAD;
typedef struct script_amf1
{
	oal_uint8  amf_type;
	oal_uint16 string_len;
}__attribute__((__packed__))SCRIPT_AMF1;
typedef struct script_amf2
{
	oal_uint8  amf_type;
	oal_uint32 length;
}__attribute__((__packed__))SCRIPT_AMF2;
#endif